/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webproxy;

/**
 *
 * @author MinhVu
 */
public class HTTPRequest {
    private String Host;
    private String Url;
    private String Method;
    private String ver;
    
    //<editor-fold defaultstate="collapsed" desc="GET - SET">
    public String getHost()
    {
        return Host;
    }
    public String getUrl()
    {
        return Url;
    }
    public String getMethod()
    {
        return Method;
    }
    public String getVer()
    {
        return ver;
    }
    public void setHost(String h)
    {
        Host = h;
    }
    public void setUrl(String u)
    {
        Url = u;
    }
    public void setMethod(String m)
    {
        Method = m;
    }
    public void setVer(String v)
    {
        ver = v;
    }
    //</editor-fold>
    
    public void PhanTichGoiTin(String data)
    {
            String strHeader[] = data.split("\r");
            for(int i = 0;i<strHeader.length;i++)
                if(strHeader[i].indexOf("Host: ") !=-1) 
                {
                    Host = strHeader[i].substring(7);
                    break;
                }
            System.out.println(strHeader[0]);
            //Phan tich url 
            String strurl[] = strHeader[0].split(" ");
            Method = strurl[0];
            Url = strurl[1].substring(7);
            ver = strurl[2];
    }
}
